From eab9c2f2b717fd5c3f54100097ff542992a4fa06 Mon Sep 17 00:00:00 2001 From: oliskoli Date: Tue, 11 Sep 2007 20:06:31 +0000 Subject: [PATCH] Minor bug fixes. git-svn-id: http://gpsbabel.googlecode.com/svn/trunk@3002 f51c46e8-681c-474f-0cfe-069cfd0219fb --- gpsbabel/win32/gui-2/GPSBabelGUI.dof | 10 +- gpsbabel/win32/gui-2/GPSBabelGUI.dpr | 3 +- gpsbabel/win32/gui-2/GPSBabelGUI.res | Bin 1748 -> 1752 bytes gpsbabel/win32/gui-2/about.pas | 2 +- gpsbabel/win32/gui-2/common.pas | 8 +- gpsbabel/win32/gui-2/filter.dfm | Bin 8943 -> 8971 bytes gpsbabel/win32/gui-2/filter.pas | 18 ++- gpsbabel/win32/gui-2/gpsbabel.iss | 10 +- gpsbabel/win32/gui-2/main.dfm | Bin 37208 -> 38553 bytes gpsbabel/win32/gui-2/main.pas | 221 +++++++++++++++++++-------- gpsbabel/win32/gui-2/options.dfm | Bin 1313 -> 1332 bytes gpsbabel/win32/gui-2/options.pas | 9 +- gpsbabel/win32/gui-2/readme.pas | 2 +- gpsbabel/win32/gui-2/select.pas | 18 +++ gpsbabel/win32/gui-2/utils.pas | 93 ++++++++++- 15 files changed, 301 insertions(+), 93 deletions(-) diff --git a/gpsbabel/win32/gui-2/GPSBabelGUI.dof b/gpsbabel/win32/gui-2/GPSBabelGUI.dof index fe1787057..95ca2d6eb 100644 --- a/gpsbabel/win32/gui-2/GPSBabelGUI.dof +++ b/gpsbabel/win32/gui-2/GPSBabelGUI.dof @@ -56,8 +56,8 @@ IncludeVerInfo=1 AutoIncBuild=0 MajorVer=0 MinorVer=2 -Release=8 -Build=2 +Release=12 +Build=0 Debug=0 PreRelease=0 Special=0 @@ -68,14 +68,16 @@ CodePage=1252 [Version Info Keys] CompanyName=GPSBabel Makers FileDescription=GPSBabel Windows Frontend -FileVersion=0.2.8.2 +FileVersion=0.2.12.0 InternalName= -LegalCopyright=(C) 2005,2006 Olaf Klein (o.b.klein@gpsbabel.org) +LegalCopyright=(C) 2005-2007 Olaf Klein (o.b.klein@gpsbabel.org) LegalTrademarks= OriginalFilename=GPSBabelGUI.exe ProductName=GPSBabel ProductVersion=1.3.x Comments= +[Excluded Packages] +$(DELPHI)\Lib\dclusr40.bpl=Borland User [HistoryLists\hlConditionals] Count=1 Item0=MSWINDOWS diff --git a/gpsbabel/win32/gui-2/GPSBabelGUI.dpr b/gpsbabel/win32/gui-2/GPSBabelGUI.dpr index bd8b0f83b..5a9a89708 100644 --- a/gpsbabel/win32/gui-2/GPSBabelGUI.dpr +++ b/gpsbabel/win32/gui-2/GPSBabelGUI.dpr @@ -1,6 +1,6 @@ program GPSBabelGUI; { - Copyright (C) 2005 Olaf Klein, o.b.klein@gpsbabel.org + Copyright (C) 2005-2007 Olaf Klein, o.b.klein@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -47,6 +47,7 @@ begin {$IFOPT D+} // UseLanguage('fr'); // for testing {$ENDIF} + Application.Initialize; Application.CreateForm(TfrmMain, frmMain); Application.CreateForm(TfrmReadme, frmReadme); diff --git a/gpsbabel/win32/gui-2/GPSBabelGUI.res b/gpsbabel/win32/gui-2/GPSBabelGUI.res index 1a5d2408dc4478155379b92392c6b729db25ec9f..a1bfc0358297484eb7ea4145e074c75d1ede98e3 100644 GIT binary patch delta 84 zcmcb@dxLjF4l|?AdN ihgnoP4H=9W^cV~n7$(1EiRRP=@(h5`d~+acGa~>}`4YGQ delta 80 zcmcb?dxdvH4l|?2FC( diff --git a/gpsbabel/win32/gui-2/about.pas b/gpsbabel/win32/gui-2/about.pas index 68aa60973..ecc118f97 100644 --- a/gpsbabel/win32/gui-2/about.pas +++ b/gpsbabel/win32/gui-2/about.pas @@ -1,7 +1,7 @@ unit about; { - Copyright (C) 2005,2006 Olaf Klein, o.b.klein@gpsbabel.org + Copyright (C) 2005-2007 Olaf Klein, o.b.klein@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gpsbabel/win32/gui-2/common.pas b/gpsbabel/win32/gui-2/common.pas index 6fddbb42f..352485aae 100644 --- a/gpsbabel/win32/gui-2/common.pas +++ b/gpsbabel/win32/gui-2/common.pas @@ -1,7 +1,7 @@ unit common; { - Copyright (C) 2005,2006 Olaf Klein, o.b.klein@gpsbabel.org + Copyright (C) 2005-2007 Olaf Klein, o.b.klein@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -72,7 +72,7 @@ const SREG_GLOBAL_LANG = 'Global:Language'; const - Profile: array[0..11] of string = + Profile: array[0..12] of string = ('?', SREG_SOURCE_DIR, SREG_SOURCE_FMT, @@ -84,7 +84,8 @@ const SREG_TARGET_SER, SREG_TARGET_FILE, SREG_SOURCE_FILE, - SREG_GLOBAL_LANG); + SREG_GLOBAL_LANG, + 'Main:Layout'); const GPSBabel_Domain = 'gpsbabel'; @@ -96,6 +97,7 @@ type Ext: string; internal: string; Capas: Integer; + url: PChar; end; type diff --git a/gpsbabel/win32/gui-2/filter.dfm b/gpsbabel/win32/gui-2/filter.dfm index c7b21a61e0bb448de60ea0297fae4703090473a3..a6a38a91c4e2e4b4571612a63d2835ce0f867d3b 100644 GIT binary patch delta 75 zcmaFw+U+LzpNk>HEy&l+(2~a aNsNcNCQEYVZ=S;ABQ}{)QJ9s90SEw^nid2A delta 83 zcmeBnd+#dvpNk>HEy&l+(PN&ZDCsYOgo3_t(?gMk@x diff --git a/gpsbabel/win32/gui-2/filter.pas b/gpsbabel/win32/gui-2/filter.pas index 396e947e5..82497865d 100644 --- a/gpsbabel/win32/gui-2/filter.pas +++ b/gpsbabel/win32/gui-2/filter.pas @@ -1,7 +1,7 @@ unit filter; { - Copyright (C) 2005,2006 Olaf Klein, o.b.klein@gpsbabel.org + Copyright (C) 2005-2007 Olaf Klein, o.b.klein@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -108,6 +108,7 @@ type Shift: TShiftState); procedure btnHelpClick(Sender: TObject); procedure cbTransformClick(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure cbGPSfixClick(Sender: TObject); private { Private-Deklarationen } @@ -175,6 +176,7 @@ var begin TranslateComponent(SELF); + RestoreBounds('filter_form', Self); cobTransformType.Items.Clear; cobTransformType.Items.Add(_('Waypoints') + ' -> ' + _('Routes')); @@ -253,6 +255,9 @@ begin gbTransform.Enabled := (common.gpsbabel_vfmt >= '001.003.002'); EnableAll(gbTransform, gbTransform.Enabled); + + cobTransformType.Enabled := cbTransform.Checked; + cbTransformDelete.Enabled := cbTransform.Checked; end; function TfrmFilter.ValidateNumerical(AEdit: TCustomEdit; AMin, AMax: Extended): Boolean; @@ -512,7 +517,8 @@ end; procedure TfrmFilter.cbTrackMergeClick(Sender: TObject); begin - if cbTrackMerge.Checked then cbTrackPack.Checked := False; + if cbTrackMerge.Checked then + cbTrackPack.Checked := False; end; procedure TfrmFilter.cbWayptMergeDistanceClick(Sender: TObject); @@ -738,11 +744,17 @@ end; procedure TfrmFilter.cbTransformClick(Sender: TObject); begin cobTransformType.Enabled := cbTransform.Checked; + cbTransformDelete.Enabled := cbTransform.Checked; +end; + +procedure TfrmFilter.FormClose(Sender: TObject; var Action: TCloseAction); +begin + StoreBounds('filter_form', Self); end; procedure TfrmFilter.cbGPSfixClick(Sender: TObject); begin - cobGPSfixes.Enabled := cbGPSfix.Checked; + cobGPSfixes.Enabled := TCheckBox(Sender).Checked; end; end. diff --git a/gpsbabel/win32/gui-2/gpsbabel.iss b/gpsbabel/win32/gui-2/gpsbabel.iss index c86cf33d4..d703b5e7a 100644 --- a/gpsbabel/win32/gui-2/gpsbabel.iss +++ b/gpsbabel/win32/gui-2/gpsbabel.iss @@ -1,14 +1,14 @@ ; Script generated by the Inno Setup Script Wizard. ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! -#define Version "1.3.2" -#define Release "" +#define Version "1.3.5" +#define Release "-beta20070807" [Setup] AppName=GPSBabel AppVerName=GPSBabel-{#Version}{#Release} RestartIfNeededByRun=false -DefaultDirName={pf}\GPSBabel-{#Version} +DefaultDirName={pf}\GPSBabel ShowLanguageDialog=auto OutputDir=C:\TEMP SourceDir=.\ @@ -48,10 +48,6 @@ Source: ..\..\gpsbabel.exe; DestDir: {app}; Flags: comparetimestamp ignoreversio Source: ..\..\gpsbabel.html; DestDir: {app}; Tasks: ; Languages: Source: ..\..\COPYING; DestDir: {app} Source: ..\..\README.contrib; DestDir: {app} -Source: ..\..\README.igc; DestDir: {app} -Source: ..\..\README.magnav; DestDir: {app} -Source: ..\..\README.mapconverter; DestDir: {app} -Source: ..\..\README.psp; DestDir: {app} Source: ..\..\AUTHORS; DestDir: {app}; Tasks: ; Languages: Source: ..\..\CHANGELOG; DestDir: {app} diff --git a/gpsbabel/win32/gui-2/main.dfm b/gpsbabel/win32/gui-2/main.dfm index 09f755c0d2ab3342e38a625f0c8c1da438cec170..66d6ff535e11a32c77de6b3ac3ccad47f0246bf4 100644 GIT binary patch delta 1831 zcmaJ?&u<$=6yDj5cl{%AT(|k9s)-MggQ~_j7YZCuf{B};IJRO7dZ0*?-Lbu5J!^Jn zNzKI)lp@h4ax@YWT!8e1P^F+fR0tK791!AwR0%;jf&>@Df&Kx&%&ynoHdTCB&+fkW zzVChWzS#!{;zzf|)PHfIR@^F;R@OI#eCquV_ft~~QVll5(UA>QC(^G#s+nzR8AM*y zHPV!R5al(bH=0EHd4FwAkyWFFu(SW>K~!mBrv!CO&w=m35&aXq4DQh-u>vymZYt*< zil0TmExHx`1bj^&vg;Mvo1AqIWA`O+&wXd?c?o3PyQwcFaNwF}UI#4d$BA#j6}LAD zMR4RkoK7UcE%)E-FC*uH$VrKc&q=KGDTy=kib`}7D^aL!AYxxK>Egn?yL{m`pugqj z;`>1tM>PKQ@AU7*?C8;;pPvN!RPNov*oKagovRW{#|<0Ef)KAj3t>_;F^MMqb+u{k ztm*7NRx#U7n@gY!m-J3_{+X%m;L&Iz&G^0_}4aA>NDSz=r zrQGK1?L^Y7ujv}vLQpGXqmwr4D~4h2lpKTTRb(KQjGOfeB+Zgzlhv!b&F^_B`c;08 zF6SplgW6U27IIU*JpUq0wkzmS{*s!HK`P! zM^8><{g@07Vr^Qa;1FqLIabE2SCQ%vq@+W2`p*O*07*i%V75Dc5u`Dk?vsHcSspip zD1;#<9<6c= z=M7Zrw2@5@ub-vw?Jjjk_^8O|nOqsdUu2qWSMUPK*xp_uEwiJuciSkVu?GZcAsREs z>khDmSdAObo4&sJeAD&>&$O2Tk3jBUA54PuDHc&^Lfk+b?Bc)%qNi?tkqsPkvRw4? z?)=#x^a-uHf9!rN#*|ldTi-TNly-X$y7Ah;8$)Zz>n(bgOY)i1xwE%Eq(gp1DeqN^A( z`P3$~pvrP>M2H2kT{o>3s z00|#F;lvb=4xbi5!efU>IA`3;F%Y!;83|I@nOD^5;*BZUqw_4Mlks%o--?DA#0^eL Hf&Kmmjtzm( delta 698 zcmYLGK}-`t6y2FE-R=@`54II!V2K73B2bKp2_6guD;P@~b`w3347)?SVLQ{zPDyG! ziQLep&PBKwIchxAO-Q{EJs7qEizg3;gNYYhw?Hrdzf9hr|NeWMZ{fi<)Q>dD z$}QycQ*-lDM$a{ydU_~!4=;215s)ofl`nyw`>w;w@&_27#crw0<~fl>(XeTzf^i zD8?G;o(PMT#%1w-V{%-%P0*5uokW*aA+ '') then s := cbInputFormat.Text + '|*.' + FCaps.GetExt(cbInputFormat.Text) + '|'; s := s + _('All files|*.*'); - OpenDialog.Filter := s; - if not SELF.OpenDialog.Execute then Exit; + dlgFileOpen.Filter := s; + if not SELF.dlgFileOpen.Execute then Exit; + + edInputFile.Text := ''; + for i := 0 to dlgFileOpen.Files.Count - 1 do + begin + s := dlgFileOpen.Files[i]; + if (Pos('"', s) <> 0) or (Pos(' ', s) <> 0) or (Pos(',', s) <> 0) then + s := AnsiQuotedStr(s, '"'); + if (edInputFile.Text <> '') then edInputFile.Text := edInputFile.Text + ', '; + edInputFile.Text := edInputFile.Text + s; + end; - edInputFile.Text := OpenDialog.FileName; CheckInput; end; @@ -466,7 +502,6 @@ begin ac := acOptionsSourceFormat; acOptionsSourceFormat.Caption := _('Input') + ': ' + Format; btnInputOpts.Caption := ''; -// ImageList1.GetBitmap(11, btnInputOpts.Glyph); end else begin edOutputOpts.Text := ''; @@ -475,7 +510,6 @@ begin ac := acOptionsTargetFormat; acOptionsTargetFormat.Caption := _('Output') + ': ' + Format; btnOutputOpts.Caption := ''; -// ImageList1.GetBitmap(11, btnOutputOpts.Glyph); end; ac.Enabled := FOpts.HasFormatOpts(Format); @@ -496,7 +530,7 @@ end; procedure TfrmMain.CheckInput; begin - acConvert.Enabled := + acLetsGo.Enabled := (cbWaypoints.Checked or cbRoutes.Checked or cbTracks.Checked) and ( @@ -542,33 +576,34 @@ procedure TfrmMain.sbSaveFileClick(Sender: TObject); var s: string; begin - SaveDialog.Filter := ''; - SaveDialog.DefaultExt := '*.*'; + dlgFileSave.Filter := ''; + dlgFileSave.DefaultExt := '*.*'; if (cbOutputFormat.Text <> '') then s := cbOutputFormat.Text + '|*.' + FCaps.GetExt(cbOutputFormat.Text) + '|'; s := s + _('All files|*.*'); - SaveDialog.Filter := s; - if not SELF.SaveDialog.Execute then Exit; + dlgFileSave.Filter := s; + if not SELF.dlgFileSave.Execute then Exit; - edOutputFile.Text := SaveDialog.FileName; + edOutputFile.Text := dlgFileSave.FileName; CheckInput; end; -procedure TfrmMain.acConvertExecute(Sender: TObject); +procedure TfrmMain.acLetsGoExecute(Sender: TObject); var cmdline: string; - list: TStrings; + list, files: TStrings; CSave: TCursor; str: TStream; s, tmp: string; i: Integer; - IFormat, OFormat: string; + IFormat, OFormat, IFiles: string; Fatal: Boolean; + sp: PChar; begin - btnProcess.Enabled := False; + acLetsGo.Enabled := False; try acFinalizeDropDownsExecute(nil); @@ -588,20 +623,34 @@ begin if cbRoutes.Checked then cmdline := cmdline + ' -r'; if cbTracks.Checked then cmdline := cmdline + ' -t'; - if mnuSynthesizeShortNames.Checked then cmdline := cmdline + ' -s'; + if acOptionsSynthesizeShortNames.Checked then cmdline := cmdline + ' -s'; if chbInputDevice.Checked then begin - s := SysUtils.AnsiLowerCase(cbInputDevice.Text) + ':'; + IFiles := '-f ' + SysUtils.AnsiLowerCase(cbInputDevice.Text) + ':'; // if (s = 'usb:') then // s := s + '-1'; end else begin - s := edInputFile.Text; - if not(FileExists(s)) then - raise eGPSBabelError.CreateFmt(_('File %s not found.'), [s]); - s := '"' + s + '"'; + IFiles := ''; + files := TStringList.Create; + try + if (edInputFile.Text[1] <> '"') then + files.CommaText := AnsiQuotedStr(edInputFile.Text, '"') + else + files.CommaText := edInputFile.Text; + for i := 0 to files.Count - 1 do + begin + s := files.Strings[i]; + if not(FileExists(s)) then + raise eGPSBabelError.CreateFmt(_('File %s not found.'), [s]); + if (IFiles <> '') then IFiles := IFiles + ' '; + IFiles := IFiles + '-f ' + AnsiQuotedStr(s, '"'); + end; + finally + files.Free; + end; end; // Input character set @@ -612,17 +661,17 @@ begin [cmdline, cbInputLang.Text]); if (Trim(edInputOpts.Text) <> '') then - cmdline := Format('%s -i %s,%s -f %s', - [cmdline, IFormat, Trim(edInputOpts.Text), s]) + cmdline := Format('%s -i %s,%s %s', + [cmdline, IFormat, Trim(edInputOpts.Text), IFiles]) else - cmdline := Format('%s -i %s -f %s', - [cmdline, IFormat, s]); + cmdline := Format('%s -i %s %s', + [cmdline, IFormat, IFiles]); if mnuOptionsForceDataType.Checked then begin s := ''; if not(cbWaypoints.Checked) then - s := s + ',waypoints'; + s := s + ',waypoints'; if not(cbRoutes.Checked) then s := s + ',routes'; if not(cbTracks.Checked) then @@ -654,23 +703,30 @@ begin end; end else begin - s := edOutputFile.Text; + s := Trim(edOutputFile.Text); + if (s <> '') and (s[1] <> '"') then s := AnsiQuotedStr(s, '"'); + if (CharCount(s, '"') mod 2 <> 0) then + begin + MessageDlg(_('Invalid usage of character ''"''!'), mtError, [mbOK], 0); + Exit; + end; + sp := PChar(s); + tmp := AnsiExtractQuotedStr(sp, '"'); + if (tmp <> '') then s := tmp; if (s <> '-') then begin if FileExists(s) then begin - tmp := _('Warning'); - if (Windows.MessageBox(SELF.Handle, - PChar(Format(_('File "%s" exists ! Overwrite ?'), [s])), - PChar(tmp), MB_YESNO) <> IDYES) then Exit; + if (MessageDlg(Format(_('File "%s" exists ! Overwrite ?'), [s]), + mtWarning, [mbYes, mbNO], 0) <> mrYes) then Exit; end else begin str := TFileStream.Create(s, fmCreate); str.Free; end; - s := '"' + s + '"'; + s := AnsiQuotedStr(s, '"'); end else s := '-'; @@ -691,8 +747,8 @@ begin CSave := Cursor; list := TStringList.Create; try - Cursor := crHourGlass; - Application.ProcessMessages; + Cursor := crHourGlass; // doesn't work ??? + Application.ProcessMessages; // doesn't work ??? Sleep(50); if not gpsbabel(cmdline, list, @Fatal, False) then @@ -718,7 +774,7 @@ begin end; finally - btnProcess.Enabled := True; + acLetsGo.Enabled := True; end; end; @@ -875,16 +931,22 @@ procedure TfrmMain.StoreProfiles; var s: string; begin - s := SysUtils.ExtractFilePath(edInputFile.Text); + if (dlgFileOpen.Files.Count > 0) then + s := SysUtils.ExtractFilePath(dlgFileOpen.Files[0]) + else + s := SysUtils.ExtractFilePath(dlgFileOpen.FileName); if (s <> '') then - StoreProfile(OpenDialog.Tag, s); - s := SysUtils.ExtractFilePath(edOutputFile.Text); + StoreProfile(dlgFileOpen.Tag, s); + if (edOutputFile.Text = '-') then + s := dlgFileSave.InitialDir + else + s := SysUtils.ExtractFilePath(edOutputFile.Text); if (s <> '') then - StoreProfile(SaveDialog.Tag, s); + StoreProfile(dlgFileSave.Tag, s); StoreProfile(cbInputFormat.Tag, cbInputFormat.Text); StoreProfile(cbOutputFormat.Tag, cbOutputFormat.Text); StoreProfile(cbInputDevice.Tag, cbInputDevice.Text); - StoreProfile(cbInputFormatDevice.Tag, cbInputFormatDevice.Text); + StoreProfile(cbInputFormatDevice.Tag, cbInputFormatDevice.Text); StoreProfile(cbOutputDevice.Tag, cbOutputDevice.Text); StoreProfile(cbOutputFormatDevice.Tag, cbOutputFormatDevice.Text); StoreProfile(edInputFile.Tag, edInputFile.Text); @@ -894,6 +956,7 @@ end; procedure TfrmMain.FormClose(Sender: TObject; var Action: TCloseAction); begin StoreProfiles; + StoreBounds('main_form', Self); end; procedure TfrmMain.chbOutputDeviceClick(Sender: TObject); @@ -939,11 +1002,6 @@ begin end; end; -procedure TfrmMain.mnuSynthesizeShortNamesClick(Sender: TObject); -begin - mnuSynthesizeShortNames.Checked := not(mnuSynthesizeShortNames.Checked); -end; - procedure TfrmMain.edOutputFileKeyPress(Sender: TObject; var Key: Char); begin FOutHandmade := True; @@ -1067,11 +1125,6 @@ begin acFinalizeDropDowns.Execute; end; -procedure TfrmMain.mnuOptionsForceDataTypeClick(Sender: TObject); -begin - mnuOptionsForceDataType.Checked := not(mnuOptionsForceDataType.Checked); -end; - procedure TfrmMain.acOptionsEnableCharactersetTransformationExecute( Sender: TObject); begin @@ -1106,6 +1159,7 @@ begin edOutputFile.Color := edInputFile.Color; chbOutputDevice.Enabled := True; edOutputFile.Enabled := True; + edOutputFile.Text := ''; HistoryChanged(edOutputFile, True); sbSaveFile.Enabled := True; end; @@ -1360,4 +1414,37 @@ begin end; end; +procedure TfrmMain.acSelectAllExecute(Sender: TObject); +begin + memoOutput.SetFocus; + memoOutput.SelectAll; +end; + +procedure TfrmMain.acCopySelectedExecute(Sender: TObject); +begin + memoOutput.SetFocus; + memoOutput.CopyToClipboard; +end; + +procedure TfrmMain.PopupMenuPopup(Sender: TObject); +begin + pmnuSelectAll.Caption := dgettext('delphi', pmnuSelectAll.Caption); + pmnuCopySelected.Caption := dgettext('delphi', pmnuCopySelected.Caption); + pmnuClearOutput.Caption := dgettext('delphi', pmnuClearOutput.Caption); + + pmnuSelectAll.Enabled := (memoOutput.Lines.Count > 0); + pmnuCopySelected.Enabled := (memoOutput.Lines.Count > 0); + pmnuClearOutput.Enabled := (memoOutput.Lines.Count > 0); +end; + +procedure TfrmMain.acOptionsSynthesizeShortNamesExecute(Sender: TObject); +begin + acOptionsSynthesizeShortNames.Checked := not(acOptionsSynthesizeShortNames.Checked); +end; + +procedure TfrmMain.acOptionsNukeTypesExecute(Sender: TObject); +begin + acOptionsNukeTypes.Checked := not(acOptionsNukeTypes.Checked); +end; + end. diff --git a/gpsbabel/win32/gui-2/options.dfm b/gpsbabel/win32/gui-2/options.dfm index a30cc841c7182acccbfd3df2c37f37f20866ac77..e9114954d2f614314e10de207a88080ea1869eb8 100644 GIT binary patch delta 138 zcmZ3;wS`OQKNmxYTad4RK!~TmUoeA#fc!)uZASNrc6I_E7`UBtGE?(P!ZTA!GMJZ7 z?0GEA?w{wJlV6<5&gqt4lnZ7~&Sy;Hy1>8+RW3GWipu72}@Cx=bZZ%8Zlsm@FsXVVcU_!N}&3nwg$a!n}8K4f7GM N88G#2lf7780RWf_CRqRg diff --git a/gpsbabel/win32/gui-2/options.pas b/gpsbabel/win32/gui-2/options.pas index 20beb518c..da32e6bf6 100644 --- a/gpsbabel/win32/gui-2/options.pas +++ b/gpsbabel/win32/gui-2/options.pas @@ -1,7 +1,7 @@ unit options; { - Copyright (C) 2005,2006 Olaf Klein, o.b.klein@gpsbabel.org + Copyright (C) 2005-2007 Olaf Klein, o.b.klein@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,6 +40,7 @@ type procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure btnOKClick(Sender: TObject); + procedure FormClose(Sender: TObject; var Action: TCloseAction); private { Private declarations } FOpts: TStringList; @@ -486,6 +487,7 @@ end; procedure TfrmOptions.FormCreate(Sender: TObject); begin TranslateComponent(Self); + RestoreBounds('options_form', Self); end; procedure TfrmOptions.btnHelpClick(Sender: TObject); @@ -847,4 +849,9 @@ begin StoreOptionsToRegistry(); end; +procedure TfrmOptions.FormClose(Sender: TObject; var Action: TCloseAction); +begin + StoreBounds('options_form', Self); +end; + end. diff --git a/gpsbabel/win32/gui-2/readme.pas b/gpsbabel/win32/gui-2/readme.pas index 97f734c30..35a1ed027 100644 --- a/gpsbabel/win32/gui-2/readme.pas +++ b/gpsbabel/win32/gui-2/readme.pas @@ -1,7 +1,7 @@ unit readme; { - Copyright (C) 2005,2006 Olaf Klein, o.b.klein@gpsbabel.org + Copyright (C) 2005-2007 Olaf Klein, o.b.klein@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gpsbabel/win32/gui-2/select.pas b/gpsbabel/win32/gui-2/select.pas index d1dddea02..eb8f27d37 100644 --- a/gpsbabel/win32/gui-2/select.pas +++ b/gpsbabel/win32/gui-2/select.pas @@ -1,5 +1,23 @@ unit select; +{ + Copyright (C) 2005-2007 Olaf Klein, o.b.klein@gpsbabel.org + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111 USA +} + interface uses diff --git a/gpsbabel/win32/gui-2/utils.pas b/gpsbabel/win32/gui-2/utils.pas index 8dbb57f74..94eded716 100644 --- a/gpsbabel/win32/gui-2/utils.pas +++ b/gpsbabel/win32/gui-2/utils.pas @@ -1,7 +1,7 @@ unit utils; { - Copyright (C) 2005,2006 Olaf Klein, o.b.klein@gpsbabel.org + Copyright (C) 2005-2007 Olaf Klein, o.b.klein@gpsbabel.org This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ interface uses gnugettext, Windows, SysUtils, Classes, StdCtrls, ComCtrls, - Registry, ShellAPI; + Registry, ShellAPI, Forms; type PBoolean = ^Boolean; @@ -36,7 +36,10 @@ function gpsbabel(const CommandLine: string; Output: TStrings; Fatal: PBoolean = nil; OEMStrings: Boolean = True): Boolean; function GetShortName(const PathName: string): string; -procedure StoreProfile(const Tag: Integer; const Value: string); + +procedure StoreProfile(const Tag: Integer; const Value: string); overload; +procedure StoreProfile(const Tag, Value: string); overload; + function ReadProfile(const Tag: Integer; const Default: string = ''): string; overload; function ReadProfile(const Name: string; const Default: string = ''): string; overload; @@ -57,10 +60,14 @@ function readme_html_path: string; function HasUpDown(E: TEdit; var UpDown: TUpdown): Boolean; +procedure StoreBounds(const Name: string; AForm: TForm); +procedure RestoreBounds(const Name: string; AForm: TForm); + +function CharCount(const Str: string; const Ch: Char): Integer; + implementation uses - Forms, common; function GetShortName(const PathName: string): string; @@ -214,6 +221,22 @@ begin end; end; +procedure StoreProfile(const Tag, Value: string); +var + reg: TRegistry; +begin + reg := TRegistry.Create; + try + reg.RootKey := HKEY_CURRENT_USER; + if reg.OpenKey('\SOFTWARE\GPSBabel', True) then + begin + reg.WriteString(Tag, Value); + end; + finally + reg.Free; + end; +end; + function ReadProfile(const Tag: Integer; const Default: string): string; // overload; var str: string; @@ -425,10 +448,70 @@ begin end; end; +procedure StoreBounds(const Name: string; AForm: TForm); +var + str: string; +begin + if (AForm = nil) then Exit; + + if (AForm.WindowState = wsMaximized) then str := 'Y' else str := 'N'; + str := Format('%s,%d,%d,%d,%d', [str, + AForm.Left, AForm.Top, AForm.Width, AForm.Height]); + StoreProfile(Name, str); +end; + +procedure RestoreBounds(const Name: string; AForm: TForm); +var + str: string; + idx: Integer; + lst: TStringList; + bds: TRect; +begin + if (AForm = nil) then Exit; + + str := ReadProfile(Name); + if (str = '') then Exit; + + lst := TStringList.Create; + try + lst.Sorted := False; + lst.Duplicates := dupAccept; + lst.CommaText := str; + try + AForm.Position := poDesigned; + + if (StrUpper(PChar(lst[0])) = 'Y') then AForm.WindowState := wsMaximized + else AForm.WindowState := wsNormal; + + bds.Left := StrToInt(lst[1]); + bds.Top := StrToInt(lst[2]); + bds.Right := bds.Left + StrToInt(lst[3]); + bds.Bottom := bds.Top + StrToInt(lst[4]); + + AForm.BoundsRect := bds; + + except + on E: Exception do; + end; + finally + lst.Free; + end; +end; + +function CharCount(const Str: string; const Ch: Char): Integer; +var + i, len: Integer; +begin + Result := 0; + len := Length(Str); + for i := 1 to len do + if (Str[i] = Ch) then + Inc(Result); +end; var hMutex: THandle; - + initialization // Flag for InnoSetup -- 2.30.2